<template>
  <h1>根组件</h1>
  <hr>
  <!-- <My-Count :type="type"></My-Count> -->
  <!-- <MyCounter></MyCounter> -->
  <!-- 在父组件中触发countChange事件的方法getCount要传参,会覆盖子组件中的事件参数,我们可以使用$event得到子组件的事件参数 -->
  <CountEvent @countChange="getCount('我是父组件的参数',$event)" ></CountEvent>
</template>

<script>
import Count from './components/Count.vue'
import MyCounter from './components/computed/MyCounter.vue'
import CountEvent from './components/customEvent/CountEvent.vue'
export default {
  name: 'App',
  data(){
    return {
      type:'success'
    }
  },
  methods:{
    getCount(val,e){
       console.log('触发了 countChange 自定义事件',val,e)
    }
  },
  components:{
    'My-Count':Count,
    MyCounter,
    CountEvent
  }
}
</script>
